﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace T.Materials.Repository.Migrations
{
    /// <inheritdoc />
    public partial class n5 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "City",
                table: "MaterialStores");

            migrationBuilder.DropColumn(
                name: "County",
                table: "MaterialStores");

            migrationBuilder.DropColumn(
                name: "Economize",
                table: "MaterialStores");

            migrationBuilder.AddColumn<int>(
                name: "CountryId",
                table: "MaterialStores",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "EconomizeId",
                table: "MaterialStores",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "Countries",
                columns: table => new
                {
                    CountryId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CountryName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EconomizeId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Countries", x => x.CountryId);
                });

            migrationBuilder.CreateTable(
                name: "Economizes",
                columns: table => new
                {
                    EconomizeId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EconomizeName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Economizes", x => x.EconomizeId);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Countries");

            migrationBuilder.DropTable(
                name: "Economizes");

            migrationBuilder.DropColumn(
                name: "CountryId",
                table: "MaterialStores");

            migrationBuilder.DropColumn(
                name: "EconomizeId",
                table: "MaterialStores");

            migrationBuilder.AddColumn<string>(
                name: "City",
                table: "MaterialStores",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "County",
                table: "MaterialStores",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Economize",
                table: "MaterialStores",
                type: "nvarchar(max)",
                nullable: true);
        }
    }
}
